package com.song.uaa.microservice.resource;

import java.util.ArrayList;
import java.util.List;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import com.song.uaa.microservice.domain.Book;

@RestController
@RequestMapping("/api/books")
@Transactional
public class BookResource {

    @GetMapping
    public ResponseEntity<List<Book>> getAllBooks(Pageable pageable) {
        // 模拟测试数据
        List<Book> books = new ArrayList<>();
        Book b1 = new Book();
        b1.setAuthor("auth0");
        b1.setId(0L);
        b1.setIsno("isno0");
        b1.setName("name0");
        
        Book b2 = new Book();
        b2.setAuthor("auth1");
        b2.setId(1L);
        b2.setIsno("isno1");
        b2.setName("name1");
        books.add(b1);
        books.add(b2);
        return ResponseEntity.ok().body(books);
    }

    
}
